<?php
/**
 * Created by litong on Date: 2019/2/25 0025 上午 9:33
 */
$host="localhost";$username="root";$password="";$dbname="php_study";
$connection = mysqli_connect($host, $username, $password, $dbname);
if(!$connection){
  echo $connection->connect_error;
}
$sql="SELECT * FROM my_guests WHERE firstname='John'";
$mysqli_result = mysqli_query($connection, $sql);
while($row = mysqli_fetch_array($mysqli_result)){
  echo $row['firstname'] . " " . $row['lastname'].PHP_EOL;
}